package com.david.concurrent.join;

/**
 * @author wade
 * @version 1.0
 * @date 2021/7/19 18:14
 */
public class JoinDemo {

    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(() -> {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("t1 over!");
        });
        Thread t2 = new Thread(() -> {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("t2 over!");
        });
        Thread t3 = new Thread(() -> {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("t3 over!");
        });
        t1.start();
        t2.start();
        t3.start();
        System.out.println("wait all child thread over!");
        t1.join();
        t2.join();
        t3.join();
        System.out.println("all child thread over,main over!");
    }
}
